home *** CD-ROM | disk | FTP | other *** search
- Path: vixen.cso.uiuc.edu!usenet
- From: Dragos-Anton Manolescu <manolesc@uiuc.edu>
- Newsgroups: comp.lang.c++
- Subject: HELP: trouble throwing a simple exception
- Date: 03 Apr 1996 17:49:32 -0600
- Organization: University of Illinois at Urbana-Champaign
- Message-ID: <opybocswab.fsf@sweetbay.will.uiuc.edu>
- Reply-To: Dragos Manolescu <manolesc@uiuc.edu>
- NNTP-Posting-Host: sweetbay.will.uiuc.edu
- X-Newsreader: Gnus v5.1
-
-
- Hello,
-
- I'm having problems throwing a simple exception. I did step-by-step
- execution with gdb and the throw statement executes, nothing happens,
- and then the statements following throw execute. Here's the relevant
- piece from my code that throws the exception:
-
- if ((nfd=open(this->szFn,O_RDONLY)) == -1) // open the file and keep the fd
- {
- cerr << "Throwing exception here" << endl;
- throw Nofile();
- }
-
-
- and here's the part from the main program:
-
- Movie *m = 0;
- try {
- m = new Movie(argv[1]);
- }
- catch (Movie::Nofile) {
- cerr << "Can't open input file " << argv[1] << endl;
- delete m; // Ok on null pointers
- delete Schedule;
- exit(-1);
- }
-
- I use g++ 2.7.2 and CXXFLAGS is -fhandle-exceptions -I/opt/parallax/include\
- -I/usr/include/X11R5 -ggdb -Wall
-
- What am I doing wrong here?
-
- Please reply by e-mail if possible. Thank you for your time!
- --
- dam http://www.uiuc.edu/ph/www/manolesc
-